package com.ebraga.trackerclub.android.dao.api;

import com.ebraga.trackerclub.android.dao.entity.UserAndroid;
import com.ebraga.trackerclub.android.exception.BackofficeDBConnectionException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeDaoException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeIllegalArgumentDaoException;

public interface UserDao {
	
	/**
	 * Validate login in local database android
	 * 
	 * @return User
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException
	 */
	UserAndroid loginOffLine(String username) throws BackofficeDBConnectionException, BackofficeDaoException;
	
	/**
	 * Insert User in the local database android
	 * 
	 * @param user
	 * @return 
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException
	 */
	Long insert(UserAndroid user) throws BackofficeDBConnectionException, BackofficeDaoException;
	
	/**
	 * Update User in the local database android
	 * @param user
	 * @return 
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException
	 */
	Long update(UserAndroid user) throws BackofficeDBConnectionException, BackofficeDaoException;

	/**
	 * Method responsible for returning last login data
	 * @return
	 */
	UserAndroid lastLogin() throws BackofficeDBConnectionException, BackofficeDaoException;
	
	/**
	 * Return User from android database
	 * 
	 * @return UserAndroid
	 * @throws BackofficeDBConnectionException
	 * @throws BackofficeDaoException
	 * @throws BackofficeIllegalArgumentDaoException
	 */
	UserAndroid getUser(String login) throws BackofficeIllegalArgumentDaoException, 
		BackofficeDBConnectionException, BackofficeDaoException;	

}